<template>
    <div class="mui-numbox" data-numbox-min="1" :data-numbox-max="max">
      <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
      <input id="test" class="mui-input-numbox" type="number" value="1" @change="mChange" ref="mValue" />
      <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script>
import mui from '../../../static/dist/js/mui'
export default {
    props:['max'],
    mounted(){
        mui('.mui-numbox').numbox();
    },
    methods: {
        mChange(){
            // console.log(this.$refs.mValue.value)
            this.$emit('getcount',parseInt(this.$refs.mValue.value))
            
        }
    },
    watch:{
        'max':function(newval,oldval){
            mui('.mui-numbox').numbox().setOption('max(Int)',newval)
        }
    }
};
</script>

<style scoped>

</style>